<?php

if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}


  class table_common_news extends discuz_table {

	public function __construct() {
		$this->_table = 'common_news';
		$this->_pk = 'id';

		parent::__construct();
	}
  
   public function fetch_list() {
		
		return DB::fetch_all('SELECT * FROM %t ORDER BY ID DESC', array($this->_table));
	} 
   
    public function fetch_count() {
		
		return DB::fetch_first('SELECT count(*) as num FROM %t ', array($this->_table));
	}

	public function fetch_all($id) {
		
		return DB::fetch_all('SELECT * FROM %t WHERE id>%d', array($this->_table,$id));
	}
   
   public function fetch_all_to($uid) {
		
		return DB::fetch_all('SELECT * FROM %t WHERE uid=%d ORDER BY ID DESC', array($this->_table,$uid));
	}
   
   public function insert( $data) {
         
		return DB::insert($this->_table ,$data);
   }
}